<%--
  Created by IntelliJ IDEA.
  User: 19416
  Date: 2022-11-08
  Time: 16:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath }/statics/layui/css/layui.css" media="all">
    <script src="${pageContext.request.contextPath }/statics/layui/layui.js"charset="utf-8"></script>
</head>
<body>
<form class="layui-form layui-form-pane" action="add" method="post" enctype="multipart/form-data">
    <div class="layui-form-item">
        <label class="layui-form-label">编号</label>
        <div class="layui-input-inline">
            <input type="text" name="supCode"  autocomplete="off" id="supCode" placeholder="请输入账号" class="layui-input" lay-verify="required">
            <span style="color: red"></span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">真实姓名</label>
        <div class="layui-input-inline">
            <input type="text" name="supName"  autocomplete="off"  placeholder="请输入真实姓名" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
            <input type="text" name="supDesc"  autocomplete="off"  placeholder="请输入密码" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="radio" name="sex" value="2" title="男" checked="">
            <input type="radio" name="sex" value="1" title="女">
            <%--            <input type="radio" name="sex" value="禁" title="禁用" disabled="">--%>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">出生日期</label>
        <div class="layui-input-inline">
            <input type="text" name="supContact" lay-verify="date"  autocomplete="off"   placeholder="请输入出生日期" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电话</label>
        <div class="layui-input-inline">
            <input type="text" name="phone"  autocomplete="off"  placeholder="请输入电话" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地址</label>
        <div class="layui-input-inline">
            <input type="text" name="supAddress"  autocomplete="off"  placeholder="请输入地址" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地址</label>
        <div class="layui-input-inline">
            <input type="text" name="supFax"  autocomplete="off"  placeholder="请输入地址" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div>
        证件照：<input type="file" name="idPic">
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>


</form>
<script src="${pageContext.request.contextPath }/statics/layui/layui.js"  charset="utf-8"></script>
<script>
    layui.use(['form', 'layedit', 'laydate','jquery'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate
            ,$ = layui.jquery;

        //创建一个编辑器
        var editIndex = layedit.build('LAY_demo_editor');
        $("#supCode").blur(function (){
            $.get("view/"+this.value, function (data) {
                if (data == "1") {
                    $("#supCode").next().html("账号已经存在！")
                    return false;
                }else {
                    $("#supCode").next().html("账号可用！").css("color","green");
                }
            });
        })



    });

</script>
</body>
</html>
